package com.umeox.moto.watch.fitness.db.dao

import androidx.room.*
import com.umeox.moto.watch.fitness.db.model.TodayChallenge

/**
 * Created by Rambo 2022/1/11
 * Describe:
 */
@Dao
interface TodayChallengeDao {

    @Query("SELECT * FROM today_challenge WHERE id = :id")
    fun queryById(id: Long): TodayChallenge?

    @Query("SELECT * FROM today_challenge")
    fun loadAllChallenge(): MutableList<TodayChallenge>?

    @Query("SELECT * FROM today_challenge WHERE isReminder = 0")
    fun loadAllNotReminderChallenge(): MutableList<TodayChallenge>?

    @Insert(onConflict = OnConflictStrategy.REPLACE)
    fun save(todayChallenge: TodayChallenge): Long

    @Update(onConflict = OnConflictStrategy.REPLACE)
    fun update(todayChallenge: TodayChallenge): Int

    @Query("DELETE FROM today_challenge")
    fun deleteAll(): Int
}